home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 21
/
CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso
/
CUCD
/
Programming
/
Python-1.4
/
Source
/
Amiga
/
Python_netlib
/
ftruncate.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-08-27
|
453b
|
29 lines
#include <errno.h>
#include <ios1.h>
#include <fcntl.h>
#include <dos.h>
#include <dos/dos.h>
#include <proto/dos.h>
#include "netlib.h"
int ftruncate(int fd, long newlength)
{
struct UFB *ufb;
/*
* find the ufb *
*/
if ((ufb = __chkufb(fd)) != NULL && !(ufb->ufbflg & UFB_SOCK))
{
if(-1==SetFileSize(ufb->ufbfh,newlength,OFFSET_BEGINNING))
{
set_errno(IoErr());
return -1;
}
return 0;
}
errno = EINVAL;
return -1;
}